import time as t
import subprocess as sp

l = []
for i in range(10):
    start = t.clock()
    p = sp.Popen('python domination.py -r random_agent -b random_agent -l clover2 -i',shell=True)
    p.wait()
    r = t.clock() - start
    l.append(r)

f = open('timeResOld.txt','w')
for i in l:
    f.write(str(i)+' ')
f.write('\nAvg '+str(float(sum(l))/len(l)))
f.write('\nMax '+str(float(max(l))))
f.write('\nMin '+str(float(min(l))))
f.close()


from domination import *
import time as t

settings = Settings(max_steps=400,cp_handle=2)
game = Game(red_brain='random_agent.py', blue_brain='random_agent.py', settings=settings, record=False,rendered=False)
l = []
for i in xrange(10):
    start = t.clock()
    game.run()
    r = t.clock() - start
    l.append(r)
    
f = open('timeResNew.txt','w')
for i in l:
    f.write(str(i)+' ')
f.write('\nAvg '+str(float(sum(l))/len(l)))
f.write('\nMax '+str(float(max(l))))
f.write('\nMin '+str(float(min(l))))
f.close()
